package com.ly.web.utils;


import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Aspect //Aop切面
@Component //非Controller，Service Repository
public class LogAspect {
    private Logger l = LoggerFactory.getLogger(LogAspect.class);

    public LogAspect(){
        System.out.println("无参构造方法");
    }

    @Around(value = "execution(* com.ly.web.controller..*.*Controller.*(..))")
    public Object writeLog(ProceedingJoinPoint jp){
        Object result =null;
        try {
            result = jp.proceed();
            l.info("切面:writeLog");
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        } finally {
        }
        return result;
    }
}
